package day5;

public class Visitor {
    public String name;
    public int age;

    public int price = 20;

    public void buyTicket() {
        if(this.age <= 7) {
            System.out.println(this.name + "的年龄为:" + this.age
            + "门票免费");
        } else {
            System.out.println(this.name + "的年龄为:" + this.age
                    + "门票价格为:" + price);
        }
    }
}
